/**
 * Project: greenline-center-biz-share
 * 
 * File Created at 2013-11-29
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package org.xukai.remoting.ftp;


/**
 * Type: FTPData <br>
 * Date: 2014-1-22 <br>
 * Desc:
 * 
 * @author jianyun.zheng
 * @version V1.0
 */
public class FTPData  {
    private static final long serialVersionUID = 1L;
    private String root;
    private String userName;
    private String passWord;
    private String host;// ftp host
    private String port;// ftp port
    private String preUrl;// ftp根路径

    public String getRoot() {
        return root;
    }

    public void setRoot(String root) {
        this.root = root;
        if (null != root && !"".equals(root)) {
            String[] str = root.trim().split(":");
            if (2 == str.length) {
                host = str[0];
                String strPort = str[1];
                int index = strPort.indexOf("/");
                port = strPort.substring(0, index);
                preUrl = strPort.substring(index + 1);
            }
        }

    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public String getHost() {
        return host;
    }

    public String getPort() {
        return port;
    }

    public String getPreUrl() {

        if (null != preUrl && !"".equals(preUrl)) {
            if (!preUrl.endsWith("/")) {
                preUrl = preUrl + "/";
            }
            return preUrl;
        } else {
            return "";
        }
    }
}
